<?php

namespace App\Kuafu\Brand\Validate;

use App\Kuafu\Base\Validate\BaseValidate;
use Illuminate\Http\Request;

class BrandValidate extends BaseValidate
{
    public static function addOrSetBrand(Request $request): string
    {
        $rules    = [
            'name'     => [
                'required',
                'max:10',
//                function ($attribute, $value, $fail) use ($request) {
//                    if (Brand::query()->where('name', '=', $request['name'])->first()) {
//                        $fail("品牌名重复，请修改");
//                    }
//                }
            ],
            'imageUrl' => 'required',
        ];
        $messages = [];
        return self::validateCheck($request->all(), $rules, $messages);
    }
}
